<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Father(name, age) {
      this.name = name
      this.age = age
      this.say = function () {
        console.log('father say')
        console.log(this);
      }
    }
    function Son(sex, name) {
      this.sex = sex
      this.name = name
      this.eat = function () {
        console.log('son eat');
        console.log(this);
      }
    }
    Son.prototype = new Father()
    Son.prototype.constructor = Son
    Son.prototype.exam = function () {
      console.log('儿子要考试了');
    }
    var s = new Son('男', '小明')
    console.log(s);
  </script>
</body>

</html>